<template>
  <div class="permission-management">
    <h2>权限管理</h2>
    <div class="operation-bar">
      <el-button type="primary" @click="handleAdd">新增权限</el-button>
    </div>
    
    <el-table :data="permissions" style="width: 100%">
      <el-table-column prop="id" label="ID" width="80" />
      <el-table-column prop="name" label="权限名称" />
      <el-table-column prop="code" label="权限编码" />
      <el-table-column prop="description" label="描述" />
      <el-table-column label="操作" width="200">
        <template #default="scope">
          <el-button size="small" @click="handleEdit(scope.row)">编辑</el-button>
          <el-button size="small" type="danger" @click="handleDelete(scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { getPermissions } from '@/api/auth'

const permissions = ref([])
onMounted(async () => {
  permissions.value = await getPermissions()
})

const handleAdd = () => {
  // TODO: 实现新增权限逻辑
}

const handleEdit = (row) => {
  // TODO: 实现编辑权限逻辑
}

const handleDelete = (row) => {
  // TODO: 实现删除权限逻辑
}
</script>

<style scoped>
.permission-management {
  padding: 20px;
}

.operation-bar {
  margin-bottom: 20px;
}
</style> 